﻿using System.Web;
using EPiServer.Personalization.VisitorGroups;

namespace EPiServer.Labs.MobilePack.Core
{
    [VisitorGroupCriterion(Category = "Visitor", LanguagePath = "/modules/MobilePack/BrowserCriterion/", DisplayName = "Device")]
    public class BrowserCriterion : CriterionBase<BrowserModel>
    {
        public override bool IsMatch(System.Security.Principal.IPrincipal principal, HttpContextBase httpContext)
        {
            return httpContext.Request.UserAgent != null && httpContext.Request.UserAgent.Contains(Model.Device);
        }
    }
}
